import os


class BaseConfig:
    SECRET_KEY = "your secret key"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    PER_PAGE_COUNT = 10
    # 图片上传地址
    UPLOAD_IMAGE_PATH = os.path.join(os.path.dirname(__file__), "media")


class DevelopmentConfig(BaseConfig):
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:root@127.0.0.1:3306/pythonbbs?charset=utf8mb4"
    # 邮箱配置
    MAIL_SERVER = "smtp.163.com"
    MAIL_USE_SSL = True
    MAIL_PORT = 465
    MAIL_USERNAME = "your_username"
    MAIL_PASSWORD = "your_passoword"
    MAIL_DEFAULT_SENDER = "your_username"
    # 缓存配置
    CACHE_TYPE = "RedisCache"
    CACHE_REDIS_HOST = "localhost"
    CACHE_REDIS_PORT = "6379"
    CACHE_REDIS_PASSWORD = "123456"
    CACHE_DEFAULT_TIMEOUT = 300
    # Celery配置 格式：redis://:password@hostname:port/db_number
    CELERY_BROKER_URL = "redis://:123456@localhost:6379/10"
    CELERY_RESULT_BACKEND = "redis://:123456@localhost:6379/10"
    # 头像上传地址
    AVATARS_SAVE_PATH = os.path.join(BaseConfig.UPLOAD_IMAGE_PATH, "avatars")


class ProductionConfig(BaseConfig):
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:root@localhost:3306/pythonbbs?charset=utf8mb4"
